# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lcms
pkgver=1.19
pkgrel=8
pkgdesc="Lightweight color management development library/engine"
url="http://www.littlecms.com"
arch="all"
license="MIT"
makedepends="tiff-dev libjpeg-turbo-dev zlib-dev"
subpackages="$pkgname-dev $pkgname-doc liblcms"
source="https://downloads.sourceforge.net/project/lcms/lcms/$pkgver/lcms-$pkgver.tar.gz
	configure-for-musl.patch
	CVE-2013-4276.patch
	ppc64le.patch
	remove-linear-interpol-test.patch
	"

prepare() {
	update_config_sub
	default_prepare
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm 644 COPYING $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

liblcms() {
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/liblcms.so.* "$subpkgdir"/usr/lib/
}

sha512sums="85a55ad0673f0df2aaa80d18caa50314319f8da5ee4d84eed919059d0dad9861d684ef6353ce0ec6f9892a4603ce8e8e12f84d46858e23f52846b8aefd3cf449  lcms-1.19.tar.gz
5ef4671234cec59a8ba088937d6e4c26cfdadbe69ad2654eeb8521fd7c15f7405fc18f860722b41e2da9f55637325fe39e36c080003eed0371e6610d2e3fd264  configure-for-musl.patch
73037e6e2f8e52f402c5160a38e1d8cc6f7f5f88145d68f733f796def539902a6dfcf685eae076d1456d885c782771993dc64f78b4e381421b0e4e8730eaa1d2  CVE-2013-4276.patch
80eb01662357123fba965300111f1d0fb524d9ae58a54bf39c9563edb6407d7a95855906c2991af6de5aa4629624fdb35d4e6c274b1c990597961ff4ec3022a9  ppc64le.patch
c7a43657b7e1f8e7402274ff5ac767e716b8a07cf44e7d089222568bdc75dcb830de2121a35db2040e52196386324b139f45ac9d014805086cf334a482efb39e  remove-linear-interpol-test.patch"
